import 'package:demo_day_1/models/user.dart';

class Repository {
  final int id;
  final String name;
  final String? description;
  final String htmlUrl;
  final User owner; // 仓库所有者，这里复用 User 模型

  Repository({
    required this.id,
    required this.name,
    this.description,
    required this.htmlUrl,
    required this.owner,
  });

  factory Repository.fromJson(Map<String, dynamic> json) {
    return Repository(
      id: json['id'],
      name: json['name'],
      description: json['description'],
      htmlUrl: json['html_url'],
      owner: User.fromJson(json['owner']), // 假设 owner 字段是 User 模型的 JSON
    );
  }
}
